{extend name='../../admin/view/table'}


{block name="content"}
<div class="think-box-shadow">
    {include file='to_cash/index_search'}
    <table id="ToCashTable" data-url="{:request()->url()}" data-target-search="form.form-search"></table>
</div>
{/block}


{block name='script'}
<script>
    $(function () {
        $('#ToCashTable').layTable({
            even: true, height: 'full',
            sort: {field: 'id', type: 'desc'},
            cols: [[
                {checkbox: true},
                {field: 'id', title: 'ID', width: 80, sort: true, align: 'center'},
                // {field: 'sort', title: '排序', width: 100, align: 'center', sort: false, templet: '#SortInputTpl'},
                {field: 'pilot.nickname', title: '飞手昵称', minWidth: 100, templet: '<div>{{d.pilot.nickname||"-"}}</div>'},
                {field: 'pilot.realname', title: '飞手姓名', minWidth: 100, templet: '<div>{{d.pilot.realname||"-"}}</div>'},
                {field: 'realname', title: '持卡人姓名', minWidth: 100},
                {field: 'bank_name', title: '银行名称', minWidth: 100},
                {field: 'branch_nane', title: '支行名称', minWidth: 100},
                {field: 'card_no', title: '银行卡号', minWidth: 100},
                {field: 'money', title: '提现金额', minWidth: 100},
                {field: 'status', title: '状态', width: 120, align: 'center', templet: '#StatusTextTpl'},
                {field: 'create_at', title: '创建时间', width: 180, align: 'center'},
                {toolbar: '#toolbar', title: '操作面板', align: 'left', minWidth: 150,  fixed: 'right'}
            ]]
        });

        // 数据状态切换操作
        layui.form.on('switch(StatusSwitch)', function (obj) {
            var data = {id: obj.value, status: obj.elem.checked > 0 ? 1 : 0};
            $.form.load("{:url('state')}", data, 'post', function (ret) {
                if (ret.code < 1) $.msg.error(ret.info, 3, function () {
                    $('#BaseTable').trigger('reload');
                });
                return false;
            }, false);
        });
    });
</script>


<!-- 列表排序权重模板 -->
<script type="text/html" id="SortInputTpl">
    <input type="number" min="0" data-blur-number="0" data-action-blur="{:sysuri()}" data-value="id#{{d.id}};action#sort;sort#{value}" data-loading="false" value="{{d.sort}}" class="layui-input text-center">
</script>

<!-- 数据状态切换模板 -->
<script type="text/html" id="StatusTextTpl">
    {{#  if(d.status == 0){ }}
    <b class="color-desc">待审核</b>
    {{#  } else if(d.status == 1){ }}
    <b class="color-green">已通过</b>
    {{#  } else if(d.status == -1){ }}
    <b class="color-red">未通过</b>
    {{#  } else { }}
    -
    {{#  } }}
</script>

<!-- 数据操作工具条模板 -->
<script type="text/html" id="toolbar">
    <!--{if auth('detail')}-->
    <a class="layui-btn layui-btn-sm layui-btn-primary" data-title="飞手提现详情" data-modal='{:url("detail")}?id={{d.id}}'>详 情</a>
    <!--{/if}-->

    <!--{if auth('review')}-->
    {{#  if(d.status == 0){ }}
    <a class="layui-btn layui-btn-sm layui-btn-normal" data-title="飞手提现审核" data-modal='{:url("review")}?id={{d.id}}' data-close-refresh="ToCashTable">审 核</a>
    {{#  } }}
    <!--{/if}-->
</script>
{/block}